package com.guopiao.vat.cronjob.job;

import java.util.Date;

import com.guopiao.vat.common.User;
import com.guopiao.vat.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;  
import org.quartz.JobExecutionContext;  
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class NewJob implements BaseJob {  
  
    private static Logger _log = LoggerFactory.getLogger(NewJob.class);
    @Autowired
    private UserService userService;

    public static NewJob newJob;

    public NewJob() {  
          
    }
    @PostConstruct
    public void init() {
        newJob = this;
    }

    public void execute(JobExecutionContext context)  
        throws JobExecutionException {
        User user = newJob.userService.findByName("xiao");
        _log.error("New Job执行时间: " + new Date() + "测试返回："+user.getCity().getCityName()+user.getCity().getDescription());
          
    }  
}  